/*************************************************************************
	> File Name: P1094.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-08 17:32:38
 ************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int w, n;
    cin >> w >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr.begin(), arr.end(), greater<int>());
    int i = 0, j = n - 1, ans = 0;
    while (i <= j) {
        if (arr[i] + arr[j] > w) {
            ans += 1;
            i++;
        } else {
            ans += 1;
            i++, j--;
        }
    }
    cout << ans << endl;
    return 0;
}
